#include <assert.h>
#include <stdlib.h>
#include <stdio.h>

union u_{
	int a;
	char b;
	float c;
}*ptr_u,var_u;

struct candidate
{
	char name[20];
	int num_ballot;
};

typedef struct node
{
	int number;
	float score;
	struct node *link;
}LinkedNode, *LinkList;

struct
{
	int num;
	char name[20];
	char sex;
	char job;
	union
	{
		int class;
		char position[20];
	}category;
}person[2];


void swap_xor(int *, int *);
void swap_plus_minus(int *, int *);
void swap_temp(int *, int *);

int func(union u_ u);
void select_sort(int array[], int n);
int partition(int array[], int n);
void quick_sort(int array[], int low, int high);
void array_reverse1(int arr[], int n);
void array_reverse2(int *arr, int n);
void copy_string(char *dest, char *src);

int cut_bit4_to_bit7(int x);
int cycle_move_right(int, int);

/*The following functions are for single list operation, the single list do not have a head node.
There is only a pointer points to the first node, at the end of the list, the last node's link
points to NULL.*/
LinkedNode *create_single_list(void);
void destory_single_list(LinkedNode *head);
void print_single_list(LinkedNode *head);
LinkedNode *delete_one_node_from_single_list(LinkedNode *head, int num);
LinkedNode * add_one_node_to_single_list(LinkedNode *head, LinkedNode *node);